<?php

namespace app\common\model\banxi\sys;

use app\common\enums\core\BoolTypeEnum;
use app\common\model\common\BaseModel;

/**
 * Attachment模型
 * @property string url              文件物理路径
 * @property int quote            上传(引用)次数
 * @property int last_upload_time 最后上传时间
 */
class SysConfig extends BaseModel
{
    protected $name = 'banxi_sys_config';

    protected $autoWriteTimestamp = true;


    protected $append = [
        'configTypeCn',
    ];


    protected $type = [
        'id' => 'string',
        'createTime' => 'timestamp:Y-m-d H:i:s',
        'updateTime' => 'timestamp:Y-m-d H:i:s',
    ];

    //-----------------------------------------------------------------------------------
    //｜                                   获取器                                       ｜
    //-----------------------------------------------------------------------------------


    public function getConfigTypeCnAttr($value, $data)
    {
        $value = $value ?: ($data['configType'] ?? '');
        return (new BoolTypeEnum())->getDescription($value) ?? '';
    }

    //-----------------------------------------------------------------------------------
    //｜                                   处理方法                                       ｜
    //-----------------------------------------------------------------------------------



}